Skip to content

Conversation

@davidgrayston-paddle
Copy link
Owner

@davidgrayston-paddle davidgrayston-paddle commented Mar 19, 2025

Added

  • HTTPX Example (Async Client)

Example Usage

from os import getenv

from paddle_billing.AsyncClient import AsyncClient

from paddle_billing.Resources.Shared.Operations import Pager

from paddle_billing.Resources.Products.Operations import ListProducts

async def list_products():
    client = AsyncClient(api_key=getenv("PADDLE_API_SECRET_KEY"))

    products = await client.products.list(ListProducts(Pager()))

    product = products.items[0]
from os import getenv

from paddle_billing.AsyncClient import AsyncClient

from paddle_billing.Entities.Shared import TaxCategory, CustomData

from paddle_billing.Resources.Products.Operations import CreateProduct

async def create_product():
    client = AsyncClient(api_key=getenv("PADDLE_API_SECRET_KEY"))

    product = await client.products.create(
        CreateProduct(
            name="Some Product",
            tax_category=TaxCategory.Standard,
            description="Some Description",
            image_url="https://paddle-sandbox.s3.amazonaws.com/user/10889/2nmP8MQSret0aWeDemRw_icon1.png",
            custom_data=CustomData(
                {
                    "features": {
                        "reports": True,
                        "crm": False,
                        "data_retention": True,
                    },
                }
            ),
        ),
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants